<?php
class Logger{
	private static $_instance = null;
	private function __construct(){
	}

	public static function singleton()
	{
		if(!isset(self::$_instance))
		{
			$c=__CLASS__;
			self::$_instance=new $c;
		}
		return self::$_instance;
	}

	public function __clone()
	{
		trigger_error('Clone is not allow' ,E_USER_ERROR);
	}
	private function log($color,$msg){
		if(DEBUG_MODE){
			echo "<font color='#$color'>==== $msg</font><br/>";
		}
	}

	public function log_i($msg){
		$this->log('4F4F4F',$msg);
	}
	public function log_d($msg){
		$this->log('2894FF',$msg);
	}
	public function log_w($msg){
		$this->log('F75000',$msg);
	}
	public function log_e($msg){
		$this->log('EA0000',$msg);
	}
	public function log_sql($sql){
		if(SQL_DEBUG){
			$this->log('6F6F6F', $sql);
		}
	}

}